;**************************************************************************** 
;Copyright © 2008-2011 Oregon State University                                
;All Rights Reserved.                                                         
;                                                                             
;                                                                             
;Permission to use, copy, modify, and distribute this software and its        
;documentation for educational, research and non-profit purposes, without     
;fee, and without a written agreement is hereby granted, provided that the    
;above copyright notice, this paragraph and the following three paragraphs    
;appear in all copies.                                                        
;                                                                             
;                                                                             
;Permission to incorporate this software into commercial products may be      
;obtained by contacting Oregon State University Office of Technology Transfer.
;                                                                             
;                                                                             
;This software program and documentation are copyrighted by Oregon State      
;University. The software program and documentation are supplied "as is",     
;without any accompanying services from Oregon State University. OSU does not 
;warrant that the operation of the program will be uninterrupted or           
;error-free. The end-user understands that the program was developed for      
;research purposes and is advised not to rely exclusively on the program for  
;any reason.                                                                  
;                                                                             
;                                                                             
;IN NO EVENT SHALL OREGON STATE UNIVERSITY BE LIABLE TO ANY PARTY FOR DIRECT, 
;INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST      
;PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 
;IF OREGON STATE UNIVERSITYHAS BEEN ADVISED OF THE POSSIBILITY OF SUCH        
;DAMAGE. OREGON STATE UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,       
;INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 
;FITNESS FOR A PARTICULAR PURPOSE AND ANY STATUTORY WARRANTY OF               
;NON-INFRINGEMENT. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS,    
;AND OREGON STATE UNIVERSITY HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE,       
;SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.                            
;                                                                             
;**************************************************************************** 

function match_type, template_array, new_dims

;this function will create a new array with dimensions new_dims of the
;   type template_array


;september 5, 05 -- fixing the execute statement so VM can run

  return, replicate(template_array[0], new_dims)

;
;  valid = 1
;  s= size(template_array, /type)
;
;  case s of
;    (1):	type = 'byt'
;    (2):  type = 'int'
;    (3):  type = 'lon'
;    (4):  type = 'flt'
;    (5):  type = 'dbl'
;    (7):  type = 'str'
;    else:  valid = 0
;  endcase
;
;  n_dims = n_elements(new_dims)
;  dimlist = ''
;  for i = 0, n_dims-1 do begin
;     dimlist = dimlist + string(new_dims(i))
;     if i ne n_dims-1 then dimlist = dimlist + ','
;  end
;  dimlist = strcompress(dimlist)
;
;  ;make executable string
;
;  p = strcompress('ret = '+type+'arr('+dimlist+')')
;  z = execute(p)
;  return, ret
;
  end

